/*********************************************************************************
 * SugarCRM Community Edition is a customer relationship management program developed by
 * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc.
 *
 * This program is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Affero General Public License version 3 as published by the
 * Free Software Foundation with the addition of the following permission added
 * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
 * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
 * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more
 * details.
 *
 * You should have received a copy of the GNU Affero General Public License along with
 * this program; if not, see http://www.gnu.org/licenses or write to the Free
 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 * 02110-1301 USA.
 *
 * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
 * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
 *
 * The interactive user interfaces in modified source and object code versions
 * of this program must display Appropriate Legal Notices, as required under
 * Section 5 of the GNU Affero General Public License version 3.
 *
 * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
 * these Appropriate Legal Notices must retain the display of the "Powered by
 * SugarCRM" logo. If the display of the logo is not reasonably feasible for
 * technical reasons, the Appropriate Legal Notices must display the words
 * "Powered by SugarCRM".
 ********************************************************************************/

/**
 * Select Task Type "Update Editor Mini-CV" to full the Create task form automatically
 */
function changetype(taskType){
	if(taskType == "UpdateEditorMiniCV"){
		var formObject = document.EditView;
		var related_editor_full_name = formObject.related_editor_full_name.value;
		// Subject: "Update Mini CV- [related Editor name]" (this field to be populated after manually input the related expert name)
		var subject = "Update Mini-CV - "+related_editor_full_name;
		// Status:Not Started
		var status = "Not Started";
		// Assigned To:CV Editing Group.
		//var assigned_user_name = "CV Editing";
		//var assigned_user_id = "dde80e76-d88d-0d00-9423-4cf61abf0c37";
		// Description: 
		// - Download the editor's Mini CV from their Document subpanel and edit the Mini CV with
		// tracked changes. Make sure to download the English version of the Mini CV.
		// - Once you have completed the edit, use the "Create Revision" feature to upload the edited
		// file as a "Revision" of the Mini CV.
		// - Once the document has been uploaded, change the status of this task to "Complete".
		var description = "- Download the editor's Mini CV from their Document subpanel and edit the Mini CV with\n tracked changes. Make sure to download the English version of the Mini CV.";
		description = description + "\n- Once you have completed the edit, use the \"Create Revision\" feature to upload the edited\n file as a \"Revision\" of the Mini CV.";
		description = description + "\n- Once the document has been uploaded, change the status of this task to \"Complete\".";
		formObject.name.value = subject;
		formObject.status.value = status;
		formObject.description.value = description;
		//formObject.assigned_user_name.value = assigned_user_name;
		//formObject.assigned_user_id.value = assigned_user_id;
	}
}

/**
 *  This function for update Subject to "Update Mini CV- [related Editor name]" while operator change related expert.
 */
function changeRelatedExpert(taskType){
	var formObject = document.EditView;
	if(formObject.type.value == "UpdateEditorMiniCV"){
		formObject.name.value = '';
		formObject.name.value =  "Update Mini-CV - "+formObject.related_editor_full_name.value;
	}
}

